<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <script src="__PUBLIC__/js/jquery-1.11.0.min.js"></script>
    <script src="__PUBLIC__/js/jquery.form.js"></script>
    <style>
        body {
            width: 960px;
            margin: 0 auto;
        }
    </style>
    <script>
        $(document).ready(function(){
            $('#btn').click(function(){
                $('#upload_form').ajaxSubmit(function(obj){
                    if (!obj.flag) {
                        alert(obj.message);
                    } else {
                        var tr = document.createElement("tr");
                        var id = document.createElement("td");
                        id.innerText = obj.id;
                        var type = document.createElement("td");
                        type.innerText = obj.type;
                        var path = document.createElement("td");
                        /*
                         * SAE change here
                         * */
                        //path.innerText = obj.path;
                        path.innerText = "__PUBLIC__" + obj.path;
                        tr.appendChild(id);
                        tr.appendChild(type);
                        tr.appendChild(path);
                        $('#tb').append(tr);
                    }
                });
                return false;
            });
        });
    </script>
</head>
<body>
<img src="__PUBLIC__/admin/tips.png" style="float: right">
<form action={:U('save')} method="post">
    <p>
        <label for="title">
            标题：
        </label>
        <input type="text" id="title" name="title" />
    </p>
    <p>
        <label for="location">
            地点：
        </label>
        <input type="text" id="location" name="location" />
    </p>
    <p>
        <label for="amount">
            金额：
        </label>
        <input type="text" id="amount" name="amount" />
    </p>
    <p>
        <label for="text">
            text：
        </label>
        <textarea id="text" name="text" ></textarea>
    </p>
    <p>
        <label for="text2">
            text2：
        </label>
        <input type="text" id="text2" name="text2" />
    </p>
    <p>
        <label for="pid">
            pid：
        </label>
        <input type="text" id="pid" name="pid" />
    </p>
    <p>
        <label for="pid2">
            pid2：
        </label>
        <input type="text" id="pid2" name="pid2" />
    </p>
    <p>
        <input type="submit" value="Submit">
    </p>
</form>
<p>
<table border="1" id="tb">
    <tr>
        <th>id</th><th>类型</th><th>路径</th>
    </tr>

</table>
</p>
<form id="upload_form" action="{:U('Upload/index')}" enctype="multipart/form-data" method="post" >
    <select name="type">
        <option value=1>Picture</option>
        <option value=2>Flv</option>
        <option value=3>Swf</option>
    </select>
    <input type="file" name="file" />
    <input type="submit" id="btn" value="提交" >
</form>
</body>
</html>